package com.zhc.dejingapi.job;


import com.zhc.dejingapi.service.upload.IEQCurrentStatusTimeUploadService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.context.annotation.Configuration;
import org.springframework.jdbc.core.JdbcTemplate;

/**
 * 设备及时状态上传任务
 */
@Slf4j
@Configuration
public class QingEquipCurrentStatusUploadJob {

    public  static  boolean isRunning=false;
    private final JdbcTemplate mysqlJdbcTemplate;
    //private final IQingAppInfoService qqingAppInfoService;
    //private final IGaogeErpBaseInfoUploadService gaogeErpBaseInfoUploadService;

    private final IEQCurrentStatusTimeUploadService qingFlowDataDownloadService;
    public QingEquipCurrentStatusUploadJob(@Qualifier("mySqlJdbcTemplate")JdbcTemplate mysqlJdbcTemplate1,
                                           IEQCurrentStatusTimeUploadService qingFlowDataDownloadService1) {
        this.mysqlJdbcTemplate = mysqlJdbcTemplate1;
        this.qingFlowDataDownloadService = qingFlowDataDownloadService1;

    }

    public  void executeJob() {
        if (isRunning) {
            log.info("QingflowMoOrderUploadJob is running");
            try {
                Thread.sleep(1000 * 60 * 5);
            } catch (Exception e) {
                e.printStackTrace();
            }

            return;
        }
        isRunning = true;


        int i = 1;

        try {
            if (i==10) {
                qingFlowDataDownloadService.UploadEQCurrentDueTime();
            }

        } catch (Exception e) {
            e.printStackTrace();
            log.error("ERPProdClassToQingJob error", e);
        }

        isRunning = false;
    }
}
